import pydatavec
import threading
class iodiskcache:
    def __init__(self,func,sizemax,workers):
        self.vec=pydatavec.pydatavec(sizemax)
        self.func=func
        for i in range(workers):
            a=threading.Thread(target=self.workfunc)
            a.start()
    def workfunc(self):
        while True:
            funcres=self.func()
            self.vec.dataadd(funcres)
    def dataget(self):
        self.vec.dataget()
        print(self.vec.vec[self.vec.vecchtmp])